import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { knowledge, resource, system, aiqa } from '@/api/apiModulesType';

// 个人文档总结 ---AI总结
export const ApiAISummary = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/document/summary`,
    data: data
  });
};

// 个人文档翻译 ---AI翻译
export const ApiAITranslate = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/documentary/translation`,
    data: data
  });
};

// 个人文档摘要---AI摘要
export const ApiAIAbstract = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/documentary/abstract`,
    data: data
  });
};

// 个人文档抽取关键词---AI抽取
export const ApiAIExtract = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/documentary/extract`,
    data: data
  });
};

// 个人文档问答 ---个人门户
export const ApiAIDocumentary = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/documentary/qa`,
    data: data
  });
};

// 查询个人AI功能是否开启 --- 个人门户/我的文档
export const ApiAIShow = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/api/personalTreeFile/selectConfigByKey`,
    params: params
  });
};

// 解析上传附件的内容
export const ApiAIfileChat = function (data?: any) {
  return request({
    method: 'post',
    url: `/${aiqa}/personal/chat/analyzeFileContent`,
    data: data
  });
};

// 文档问答总结功能
export const ApiAIfileSummarize = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/documentary/file/summarize`,
    data: data
  });
};

// 文档问答翻译功能
export const ApiAIfileTranslation = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/documentary/file/translation`,
    data: data
  });
};

// 查询当前人员的历史对话
export const ApiAIHistory = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/personal/chat/history/get`,
    params: params
  });
};

// 保存或者修改普通问答历史记录
export const ApiAIHistoryAddorEdit = function (data?: any) {
  return request({
    method: 'post',
    url: `/${knowledge}/personal/chat/history/add/or/edit`,
    data: data
  });
};

// 根据id查询对话的历史内容
export const ApiAIHistoryId = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/personal/chat/history/get/${params}`,
    params: params
  });
};

//  根据id删除单个历史对话 清空当前用户的所有普通问答历史
export const ApiAIHistorydelOnly = function (data?: any) {
  return request({
    method: 'delete',
    url: `/${knowledge}/personal/chat/history/delete/${data}`
  });
};

//  清空当前用户的所有普通问答历史
export const ApiAIHistorydelMany = function () {
  return request({
    method: 'delete',
    url: `/${knowledge}/personal/chat/history/delete`
  });
};

// 获取文件的导图(脑图)预览
export const ApiAImarkDown = function (params?: any) {
  return request({
    method: 'get',
    url: `/${aiqa}/personal/chat/markDown`,
    params: params
  });
};

// markdown显示成流程图
export const ApiAIflowChart = function (params?: any) {
  return request({
    method: 'get',
    url: `/${knowledge}/personal/chat/flowChart`,
    params: params
  });
};
